<!--
 * @Author: zsc
 * @Date: 2022-07-20 00:12:51
 * @LastEditors: zsc
 * @LastEditTime: 2022-07-24 20:04:21
 * @Description:公安端看板
-->
<template>
  <div className="dashboard-editor-container">
    <el-card>
      <entrance />
    </el-card>
    <panel-group @handleSetLineChartData="handleSetLineChartData" />
    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <line-chart :chart-data="lineChartData" />
    </el-row>
    <el-row>
      <el-button type="primary" style="margin-left: 50%;margin-bottom: 10px;" @click="handelSuggest">意见/问题反馈</el-button>
    </el-row>
    <Suggest :visible.sync="suggestVisible" />
  </div>

</template>

<script>
import PanelGroup from './components/PanelGroup2'
import LineChart from './components/LineChart'
import entrance from '@/views/entrance'
import Suggest from '@/views/help/suggest'
const lineChartData = {
  newVisitis: {
    expectedData: [100, 99, 101, 102, 103, 105, 107],
    actualData: [10.1, 10.2, 10.3, 10.4, 10.5, 10.5, 10.5]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  components: {
    PanelGroup,
    LineChart,
    entrance,
    Suggest
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis,
      suggestVisible: false
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    },
    handelSuggest() {
      console.log('handelSuggest')
      this.suggestVisible = true
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
